<?php
class Vs_Reason_Mapper
    extends Vs_Mapper
	
{
    public function loadFamily( $reasons )
	{
		$mapper = Vs_Factory::mapper('ReasonFamily');
		
		if (  $reasons instanceof Vs_Reason_Collection ){

			if (count( $reasons ) < 1){
				return;
			}
			
			$reasonFamilies = $mapper->getByIds( $reasons->getKeyValues( 'reasonFamilyId', true ) );
			$reasons->setFamily($reasonFamilies);
			
		}
	 	elseif ( $reasons instanceof VS_Reason){
	 		$reasons->setFamily(
	 			$mapper->getById( $reasons->reasonFamilyId )
	 		);
		}
	}
}
